﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MotDePasseBD
{
    /*Login et mot de passe de l'application :
        admin
        cabane
    */
    public partial class Form1 : Form
    {
        Confirmation_d_identiter frmConfirmation = new Confirmation_d_identiter();
        public Form1()
        {
            InitializeComponent();
            frmConfirmation.ShowDialog();
        }

        private static string CripterMotDePasse(string pPassword)
        {
            string chaineARetourner = string.Empty;
            foreach (char item in pPassword)
            {
                chaineARetourner += (char)(item + 'A');
            }

            return chaineARetourner;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (!frmConfirmation.Confirmation)
            {
                MessageBox.Show("Imposteur !!!!");
                this.Close();
            }
            if (textBox3.Text == textBox2.Text)
            {

                MessageBox.Show("Veuillez copier le resultat obtenu dans\n le fichier config.txt du programme");
                textBox1.Text = CripterMotDePasse(textBox2.Text);


            }
            else
                MessageBox.Show("Les deux mots de passes ne sont pas identiques");

            textBox3.Text = "";
            textBox2.Text = "";


        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
